home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 406_01 / atoc / stdmacro.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-09  |  1.3 KB  |  54 lines

  1. /*=========================================================================
  2.  
  3.     ATOC standard macro module
  4.  
  5. =========================================================================*/
  6.  
  7. #include <stdio.h>
  8. #include "atoc.h"
  9.  
  10.  
  11. /*-------------------------------------------------------------------------
  12. stdmacro( s ) replaces any variable standard macros.
  13. -------------------------------------------------------------------------*/
  14. stdmacro( s )
  15. char *s;
  16. {
  17.     char *cp, temp[ 80 ], *strstr();
  18.  
  19.     if ( ( cp = strstr( s, "__FILE__" ) ) != NULL )
  20.     {
  21.         strcpy( cp, cp + 8 );
  22.         strcpy( temp, "\"" );
  23.         strcat( temp, filename );
  24.         strcat( temp, "\"" );
  25.         strins( cp, temp );
  26.     }
  27.  
  28.     if ( ( cp = strstr( s, "__LINE__" ) ) != NULL )
  29.     {
  30.         strcpy( cp, cp + 8 );
  31.         sprintf( temp, "%d", linenumber );
  32.         strins( cp, temp );
  33.     }
  34.  
  35.     if ( ( cp = strstr( s, "__DATE__" ) ) != NULL )
  36.     {
  37.         strcpy( cp, cp + 8 );
  38.         strcpy( temp, "\"" );
  39.         strcat( temp, compiledate );
  40.         strcat( temp, "\"" );
  41.         strins( cp, temp );
  42.     }
  43.  
  44.     if ( ( cp = strstr( s, "__TIME__" ) ) != NULL )
  45.     {
  46.         strcpy( cp, cp + 8 );
  47.         strcpy( temp, "\"" );
  48.         strcat( temp, compiletime );
  49.         strcat( temp, "\"" );
  50.         strins( cp, temp );
  51.     }
  52. }
  53. /*=======================================================================*/
  54.